# Maintainer: Anatol Pomozov
# Contributor: Tommaso Sardelli <lacapannadelloziotom at gmail dot com>

pkgname=bpftrace
pkgver=0.19.1
pkgrel=1
pkgdesc='High-level tracing language for Linux eBPF'
arch=('loong64' 'x86_64')
url='https://github.com/iovisor/bpftrace'
license=('Apache')
depends=('libelf' 'zlib' 'llvm-libs' 'clang' 'bcc' 'libbpf' 'libpcap' 'libsframe.so')
makedepends=('cmake' 'llvm' 'git' 'linux-headers' 'ninja' 'gtest' 'cereal'
             'asciidoctor' 'xxd')
options=('!strip' '!debug')
source=("https://github.com/iovisor/bpftrace/archive/v$pkgver/bpftrace-$pkgver.tar.gz")
sha512sums=('2f56b8fb7abfa58631ebc93c7a98cc066446808cbc0116902e43ebefa5f9625232da5ee3ede1d14a236296660a2f4c0907fa1ef24d383b4e32c70dcc3988c765')

build() {
  cmake -S bpftrace-$pkgver -B build -G Ninja \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DUSE_SYSTEM_BPF_BCC=ON
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
